home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
man
/
oldman3
/
N_Node.3T
< prev
next >
Wrap
Text File
|
1992-06-26
|
5KB
|
201 lines
.TH N_NODE
.SH NAME
N_Node<Type,nchild> \f1 Parameterized static-sized n-ary node class
.SH SYNOPSIS
#include <cool/N_Node.h>
.SH DESCRIPTION
The \f3N_Node<Type,nchild>\f1 class implements parameterized nodes of a static size
for n-ary trees. This node class is parameterized for both the type and some
initial number of subtrees that each node may have. The constructors for the
\f3N_Node<Type,nchild>\f1 class are declared in the public section to allow the user
to create nodes and control the building and structure of an n-ary tree where
the ordering can have a specific meaning, as with an expression tree.
.SH Base Classes
None
.SH Friend Classes
\f3N_Tree<Node,Type,nchild>
.SH Public Constructors
.TP
\f3N_Node<Type,nchild> ();\f1
Allocates an N-node with all subtree pointers set to
NULL .
.TP
\f3N_Node<Type,nchild> (const Type& value\f3);\f1
Allocates an N-node with all subtree pointers set to
NULL
and initializes the
value of the node to
value .
.TP
\f3N_Node<Type,nchild> (const N_Node<Type,nchild>& nn\f3);\f1
Duplicates the value of another N-node object
nn .
.SH Member Functions
.TP
inline Type& get () const;
Returns a reference to the value of the data member.
.TP
\f3Boolean insert_after (N_Node<Type,nchild>& nn\f3, int \f2index\f3);\f1
Inserts a subtree pointer to
nn
after the zero-relative
index
given. This
function returns
TRUE
if successful; otherwise, this function returns
FALSE .
If
index
is negative or out of range, an
\f3\f3Error\f1\f1
exception is raised.
.TP
\f3Boolean insert_before (N_Node<Type,nchild>& nn\f3, int \f2index\f3);\f1
Inserts a subtree pointer to
nn
before the zero-relative
index .
This function
returns
TRUE
if successful; otherwise, this function returns
FALSE .
If
index
is
negative or out of range, an
\f3\f3Error\f1\f1
exception is raised.
.TP
Boolean is_leaf () const;
Determines if the node is a terminal node by evaluating the subtree pointers.
If all pointers are
NULL ,
this function returns
TRUE ;
otherwise, this function returns
FALSE .
.TP
inline int num_subtrees () const;
Returns the maximum number of subtrees possible for a node.
.TP
\f3N_Node<Type,nchild>& \f3operator= (N_Node<Type,nchild>& nn\f3);\f1
Overloads the assignment operator for the class to assign the values of the
subtree pointers and the value in
nn
to the node object. This function returns
a reference to the updated node.
.TP
\f3inline Boolean operator== (const Type& value\f3) const;\f1
Overloads the equality operator for the \f3N_Node<Type> \f1class. This function returns
TRUE
if \f2value\f1 is equal to the value of the node object; otherwise, this
function returns
FALSE .
.TP
\f3inline Boolean operator!= (const Type& value\f3) const;\f1
Overloads the inequality operator for the \f3N_Node<Type>\f1 class. This function
returns
TRUE
if
value
is not equal to the value of the node object; otherwise,
this function returns
FALSE .
.TP
\f3inline Boolean operator< (const Type& value\f3) const;\f1
Overloads the less-than operator for the \f3N_Node<Type>\f1 class. This function
returns
TRUE
if
value
is less than the value of the node object; otherwise,
this function returns
FALSE .
.TP
\f3inline Boolean operator<= (const Type& value\f3) const;\f1
Overloads the less-than-or-equal operator for the \f3N_Node<Type>\f1 class. This
function returns
TRUE
if
value
is less than or equal to the value of the node
object; otherwise, this function returns
FALSE.
.TP
\f3inline Boolean operator> (const Type& value\f3) const;\f1
Overloads the greater-than operator for the \f3N_Node<Type>\f1 class. This function returns
TRUE
if
value
is greater than the value of the node object; otherwise,
this function returns
FALSE .
.TP
\f3inline Boolean operator>= (const Type& value\f3) const;\f1
Overloads the greater-than-or-equal operator for the \f3N_Node<Type> \f1class. This
function returns
TRUE
if
value
is greater than or equal to the value of the
node object; otherwise, this function returns
FALSE .
.TP
\f3inline N_Node<Type,nchild>*& \f3operator[\^] (int \f2index\f3);\f1
Returns a reference to a pointer to the subtree at the zero-relative
index .
If
index
is negative or out of range, an
\f3\f3Error\f1\f1
exception is raised.
.TP
\f3inline void set (const Type& value\f3);\f1
Sets the value of the data member in the node to
value .
.TP
\f3inline void set_compare (\f2N_Node_Compare \f3= NULL);\f1
Sets the comparison function that is to be used in all comparison tests.
N_Node_Compare
is a function of type
Boolean
(\f2*Function\f1)(\f3const Type&\f1, \f3const Type&\f1). If no argument is provided, the
operator==
for the type over which the
class is parameterized is used.
.SH COPYRIGHT
Copyright (C) 1991 Texas Instruments Incorporated.
Permission is granted to any individual or institution to use, copy, modify,
and distribute this software, provided that this complete copyright and
permission notice is maintained, intact, in all copies and supporting
documentation.
Texas Instruments Incorporated provides this software "as is" without
express or implied warranty.